#ifndef _LINEHELPER_H
#define _LINEHELPER_H

#include "WEInterface.h"
#include "WEExternal.h"
#include "GraphicsDevice.h"

using namespace std;

namespace WuguiEngine
{
	class IDisposed;
	class IUpdatable;
	class IRenderable;

	namespace Graphics
	{
		class GraphicsDevice;

		struct LineVertex
		{
			float x, y, z;
			DWORD color;
		};

		class LineHelper : IDisposed, IUpdatable, IRenderable
		{
		public:
			void AddLine(D3DXVECTOR3 dot1, D3DXVECTOR3 dot2,
				D3DCOLOR color);

			virtual void Render(DWORD dt);
			virtual void Update(DWORD dt);
			virtual void Dispose();

			static LineHelper* GetInstance();
			static void Initialize(GraphicsDevice* device);
		protected:
			LineHelper(GraphicsDevice* device);

			GraphicsDevice* pDevice;
			int LineCount;
			static DWORD LineVertexFVF;
			static LineHelper* instance;
			vector<LineVertex> lineVertexData;
			IDirect3DVertexBuffer9* pVertexBuffer;

			bool isVertexDataChanged;
		};
	}
}

#endif